<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich" template="layout/template.xhtml">

	<ui:define name="body">
	
	<h:messages globalOnly="true" styleClass="message" id="globalMessages"/>
	
	<h:form id="navioSearch" styleClass="edit">
	
		<rich:simpleTogglePanel label="Cliente search parameters" switchType="ajax" >
	        <h:panelGrid columns="3">
	        	
	            <s:decorate template="layout/display.xhtml">	                         
	                 <ui:define name="label">Nome</ui:define>	           
	                <h:inputText id="nome" value="#{navioList.navio.nome}"/>
	            </s:decorate>
	            <s:decorate template="layout/display.xhtml">	            
	                <ui:define name="label">Numero</ui:define>	            
	                <h:inputText id="numero" value="#{navioList.navio.numero}"/>
	            </s:decorate>	          
	       </h:panelGrid>      	
	        
	    </rich:simpleTogglePanel>
	    
        <div class="actionButtons">
            <h:commandButton id="search" value="Search" action="#{navioList.pesquisar}"/>
        </div>
		
		<rich:panel>
        <f:facet name="header">Pesquisa Navio</f:facet>
    		<div class="results" id="navioList">
    		
    		<h:outputText value="The navio search returned no results." 
               rendered="#{empty navioList.navios}"/>
    		    	
    		    	<rich:dataTable id="navioList" 
                var="_navio"
              value="#{navioList.navios}" 
           rendered="#{not empty navioList.navios}">
            
        <h:column>
            <f:facet name="header">
                <s:link styleClass="columnHeader"
                             value="nome #{navioList.order=='nome asc' ? messages.down : ( navioList.order=='nome desc' ? messages.up : '' )}">
                    <f:param name="order" value="#{navioList.order=='nome asc' ? 'nome desc' : 'nome asc'}"/>
                </s:link>
            </f:facet>
            <h:outputText value="#{_navio.nome}"/>
        </h:column>
        
          <h:column>
            <f:facet name="header">
                <s:link styleClass="columnHeader"
                             value="idade #{navioList.order=='idade asc' ? messages.down : ( navioList.order=='idade desc' ? messages.up : '' )}">
                    <f:param name="order" value="#{navioList.order=='idade asc' ? 'idade desc' : 'idade asc'}"/>
                </s:link>
            </f:facet>
            <h:outputText value="#{_navio.idade}">
                <s:convertDateTime type="date" dateStyle="short"/>
            </h:outputText>
        </h:column>
        
        <h:column>
            <f:facet name="header">Action</f:facet>
            <s:link view="/#{empty from ? 'navio' : from}.xhtml" 
                   value="Select" 
                      id="navio">
                <f:param name="navioId" 
                        value="#{_navio.id}"/>
            </s:link>
        </h:column>
    </rich:dataTable>
    		    	
    		    	
    		    		
    		</div>
    	</rich:panel>

		</h:form>

	</ui:define>

</ui:composition>

